﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using CORSSupport;
using DBO.Economy;
using DBO;

namespace RESTDataService
{
    [ServiceContract]
    public interface IRESTDataService
    {
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   UriTemplate = "resource?troop={name}"), CorsEnabled]
        Resources GetResource(string name);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   UriTemplate = "{token}/resource"), CorsEnabled]
        Resources GetPlayerResource(string token);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   UriTemplate = "statistics?name={name}"), CorsEnabled]
        UnitStatistics GetStatistics(string name);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   UriTemplate = "races"), CorsEnabled]
        IList<Race> GetRaces();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   UriTemplate = "slots/{type}/buy?token={token}"), CorsEnabled]
        bool BuySlot(string token, string type);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   UriTemplate = "slots/{type}/sell?token={token}"), CorsEnabled]
        bool SellSlot(string token, string type);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
           RequestFormat = WebMessageFormat.Json,
           BodyStyle = WebMessageBodyStyle.Bare,
           UriTemplate = "slots/{type}/count?token={token}"), CorsEnabled]
        int CountSlots(string token, string type);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
           RequestFormat = WebMessageFormat.Json,
           BodyStyle = WebMessageBodyStyle.Bare,
           UriTemplate = "info?token={token}"), CorsEnabled]
        Player GetPlayerInfo(string token);
    }
}
